grammar := laban
ACFLAGS := --config puma.config --weave_only -I. -I../grmr/ -I../check/ -I../translate/ -I../graph/ ../main/main.cpp
AG := ../../3rd/./ag++
config = --gen_config -o puma.config
depends = ../main/main.cpp adot.ah ../translate/translate.h ../check/check.h 

.PHONY:	clean

all: main.cpp $(depends)
	$(AG) -I. -I../grmr/ -I../check/ -I../translate/ -I../graph/ -c main.cpp
	ar rcs libmain.a main.o
	mv main.o ../../.objs/main.o
	mv libmain.a ../../lib/libmain.a

main.cpp: $(depends)
	$(AG) $(config)
	$(AG) $(ACFLAGS) -a adot.ah -o main.cpp

clean:
	rm -f main.o puma.config
	rm -f ../../.objs/main.o
	rm -f ../../lib/libmain.a
	rm -f main.cpp
